package app.auto.runner.base.acty;

import android.app.ActionBar;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.Application;
import android.app.Dialog;
import android.app.DirectAction;
import android.app.Fragment;
import android.app.LoaderManager;
import android.app.PictureInPictureParams;
import android.app.SharedElementCallback;
import android.app.TaskStackBuilder;
import android.app.VoiceInteractor;
import android.app.assist.AssistContent;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentSender;
import android.content.LocusId;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.net.Uri;
import android.os.Bundle;
import android.os.CancellationSignal;
import android.os.PersistableBundle;
import android.transition.TransitionManager;
import android.view.ActionMode;
import android.view.ContextMenu;
import android.view.DragAndDropPermissions;
import android.view.DragEvent;
import android.view.KeyEvent;
import android.view.KeyboardShortcutGroup;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.SearchEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityEvent;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.TextView;
import android.widget.Toolbar;

import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.List;
import java.util.function.Consumer;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import app.auto.AndroidInstance;
import app.auto.runner.base.utility.ToastUtil;

public class ActivityInstance extends AndroidInstance {

    ToastUtil toastUtil;

    public ActivityInstance() {
    }

    public void showToast(String string) {
        if (toastUtil == null) {
            toastUtil = new ToastUtil(getActivity());

        }
        toastUtil.toast(string, "");
    }

    public String getTextString(int id) {
        return ((TextView) getActivity().findViewById(id)).getText().toString();
    }

    public TextView getTextView(int id) {
        return (TextView) getActivity().findViewById(id);
    }

    public void setTextString(int id, String t) {
        ((TextView) getActivity().findViewById(id)).setText(t);
    }

    public EditText getEditText(int id) {
        return (EditText) findViewById(id);
    }

    public RadioButton getRadioButton(int id) {
        return (RadioButton) findViewById(id);
    }

    public ImageView getImageView(int id) {
        return (ImageView) findViewById(id);
    }

    public View getView(int id) {
        return findViewById(id);
    }

    public void click(int id, View.OnClickListener onClickListener) {
        getView(id).setOnClickListener(onClickListener);
    }


    public void setTextString(View view, int id, String t) {
        ((TextView) view.findViewById(id)).setText(t);
    }

    public ViewGroup getGroup(int id) {
        return (ViewGroup) findViewById(id);
    }

    public Activity getActivity() {
        return (Activity) getContext();
    }

    public Intent getIntent() {
        return getActivity().getIntent();
    }


    public void setIntent(Intent newIntent) {

    }

    public void setLocusContext(@Nullable LocusId locusId, @Nullable Bundle bundle) {
    }


    public WindowManager getWindowManager() {
        return getActivity().getWindowManager();
    }


    public Window getWindow() {
        return getActivity().getWindow();
    }


    public LoaderManager getLoaderManager() {
        return getActivity().getLoaderManager();
    }


    public void attachBaseContext(Context newBase) {
    }


    public void registerActivityLifecycleCallbacks(@NonNull Application.ActivityLifecycleCallbacks callback) {
    }


    public void unregisterActivityLifecycleCallbacks(@NonNull Application.ActivityLifecycleCallbacks callback) {
    }


    public void onCreate(@Nullable Bundle savedInstanceState) {
    }


    public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
    }


    public void onRestoreInstanceState(@NonNull Bundle savedInstanceState) {
    }


    public void onRestoreInstanceState(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
    }


    public void onPostCreate(@Nullable Bundle savedInstanceState) {
    }


    public void onPostCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
    }


    public void onStart() {
    }


    public void onRestart() {
    }


    public void onStateNotSaved() {
    }


    public void onResume() {
    }


    public void onPostResume() {
    }


    public void onTopResumedActivityChanged(boolean isTopResumedActivity) {
    }


    public boolean isVoiceInteraction() {
        return false;
    }


    public boolean isVoiceInteractionRoot() {
        return false;
    }


    public VoiceInteractor getVoiceInteractor() {
        return null;
    }


    public boolean isLocalVoiceInteractionSupported() {
        return false;
    }


    public void startLocalVoiceInteraction(Bundle privateOptions) {
    }


    public void onLocalVoiceInteractionStarted() {
    }


    public void onLocalVoiceInteractionStopped() {
    }


    public void stopLocalVoiceInteraction() {
    }


    public void onNewIntent(Intent intent) {
    }


    public void onSaveInstanceState(@NonNull Bundle outState) {
    }


    public void onSaveInstanceState(@NonNull Bundle outState, @NonNull PersistableBundle outPersistentState) {
    }


    public void onPause() {
    }


    public void onUserLeaveHint() {
    }


    public boolean onCreateThumbnail(Bitmap outBitmap, Canvas canvas) {
        return getActivity().onCreateThumbnail(outBitmap, canvas);
    }


    public CharSequence onCreateDescription() {
        return getActivity().onCreateDescription();
    }


    public void onProvideAssistData(Bundle data) {

    }


    public void onProvideAssistContent(AssistContent outContent) {
    }


    public void onGetDirectActions(@NonNull CancellationSignal cancellationSignal, @NonNull Consumer<List<DirectAction>> callback) {
    }


    public void onPerformDirectAction(@NonNull String actionId, @NonNull Bundle arguments, @NonNull CancellationSignal cancellationSignal, @NonNull Consumer<Bundle> resultListener) {
    }


    public void onProvideKeyboardShortcuts(List<KeyboardShortcutGroup> data, Menu menu, int deviceId) {
    }


    public boolean showAssist(Bundle args) {
        return false;
    }


    public void onStop() {
    }


    public void onDestroy() {
    }


    public void reportFullyDrawn() {
        getActivity().reportFullyDrawn();
    }


    public void onMultiWindowModeChanged(boolean isInMultiWindowMode, Configuration newConfig) {
    }


    public void onMultiWindowModeChanged(boolean isInMultiWindowMode) {
    }


    public boolean isInMultiWindowMode() {
        return false;
    }


    public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode, Configuration newConfig) {
    }


    public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode) {
    }


    public boolean isInPictureInPictureMode() {
        return false;
    }


    public void enterPictureInPictureMode() {
    }


    public boolean enterPictureInPictureMode(@NonNull PictureInPictureParams params) {
        return false;
    }


    public void setPictureInPictureParams(@NonNull PictureInPictureParams params) {
    }


    public void onConfigurationChanged(@NonNull Configuration newConfig) {
    }


    public void onLowMemory() {

    }


    public void onTrimMemory(int level) {

    }


    public void onAttachFragment(Fragment fragment) {

    }


    public void startManagingCursor(Cursor c) {

    }


    public void stopManagingCursor(Cursor c) {

    }


    public <T extends View> T findViewById(int id) {
        return getActivity().findViewById(id);
    }

    @Nullable

    public ActionBar getActionBar() {
        return getActivity().getActionBar();
    }


    public void setActionBar(@Nullable Toolbar toolbar) {
    }


    public void setContentView(int layoutResID) {
        getActivity().setContentView(layoutResID);
    }


    public void setContentView(View view) {
        getActivity().setContentView(view);
    }


    public void setContentView(View view, ViewGroup.LayoutParams params) {
    }


    public void addContentView(View view, ViewGroup.LayoutParams params) {
    }

    public void setContentTransitionManager(TransitionManager tm) {
    }


    public void setFinishOnTouchOutside(boolean finish) {
    }


    public void onBackPressed() {

    }


    public boolean onKeyShortcut(int keyCode, KeyEvent event) {
        return getActivity().onKeyShortcut(keyCode, event);
    }


    public boolean onTouchEvent(MotionEvent event) {
        return getActivity().onTouchEvent(event);
    }


    public boolean onTrackballEvent(MotionEvent event) {
        return getActivity().onTrackballEvent(event);
    }


    public boolean onGenericMotionEvent(MotionEvent event) {
        return getActivity().onGenericMotionEvent(event);
    }


    public void onUserInteraction() {

    }


    public void onWindowAttributesChanged(WindowManager.LayoutParams params) {
    }


    public void onContentChanged() {

    }


    public void onWindowFocusChanged(boolean hasFocus) {
    }


    public void onAttachedToWindow() {

    }


    public void onDetachedFromWindow() {

    }


    public boolean hasWindowFocus() {
        return getActivity().hasWindowFocus();
    }


    public boolean dispatchKeyEvent(KeyEvent event) {
        return getActivity().dispatchKeyEvent(event);
    }


    public boolean dispatchKeyShortcutEvent(KeyEvent event) {
        return getActivity().dispatchKeyShortcutEvent(event);
    }


    public boolean dispatchTouchEvent(MotionEvent ev) {
        return getActivity().dispatchTouchEvent(ev);
    }


    public boolean dispatchTrackballEvent(MotionEvent ev) {
        return getActivity().dispatchTrackballEvent(ev);
    }


    public boolean dispatchGenericMotionEvent(MotionEvent ev) {
        return getActivity().dispatchGenericMotionEvent(ev);
    }


    public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
        return getActivity().dispatchPopulateAccessibilityEvent(event);
    }

    @Nullable

    public View onCreatePanelView(int featureId) {
        return getActivity().onCreatePanelView(featureId);
    }


    public boolean onCreatePanelMenu(int featureId, @NonNull Menu menu) {
        return getActivity().onCreatePanelMenu(featureId, menu);
    }


    public boolean onPreparePanel(int featureId, @Nullable View view, @NonNull Menu menu) {
        return getActivity().onPreparePanel(featureId, view, menu);
    }


    public boolean onMenuOpened(int featureId, @NonNull Menu menu) {
        return getActivity().onMenuOpened(featureId, menu);
    }


    public boolean onMenuItemSelected(int featureId, @NonNull MenuItem item) {
        return getActivity().onMenuItemSelected(featureId, item);
    }


    public void onPanelClosed(int featureId, @NonNull Menu menu) {
    }


    public void invalidateOptionsMenu() {
        getActivity().invalidateOptionsMenu();
    }


    public boolean onCreateOptionsMenu(Menu menu) {
        return getActivity().onCreateOptionsMenu(menu);
    }


    public boolean onPrepareOptionsMenu(Menu menu) {
        return getActivity().onPrepareOptionsMenu(menu);
    }


    public boolean onOptionsItemSelected(@NonNull MenuItem item) {
        return getActivity().onOptionsItemSelected(item);
    }


    public boolean onNavigateUp() {
        return getActivity().onNavigateUp();
    }


    public boolean onNavigateUpFromChild(Activity child) {
        return getActivity().onNavigateUpFromChild(child);
    }


    public void onCreateNavigateUpTaskStack(TaskStackBuilder builder) {
    }


    public void onPrepareNavigateUpTaskStack(TaskStackBuilder builder) {
    }


    public void onOptionsMenuClosed(Menu menu) {
        getActivity().onOptionsMenuClosed(menu);
    }


    public void openOptionsMenu() {
        getActivity().openOptionsMenu();
    }


    public void closeOptionsMenu() {
        getActivity().closeOptionsMenu();
    }


    public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
        getActivity().onCreateContextMenu(menu, v, menuInfo);
    }


    public void registerForContextMenu(View view) {
    }


    public void unregisterForContextMenu(View view) {
    }


    public void openContextMenu(View view) {
        getActivity().openContextMenu(view);
    }


    public void closeContextMenu() {
        getActivity().closeContextMenu();
    }


    public boolean onContextItemSelected(@NonNull MenuItem item) {
        return getActivity().onContextItemSelected(item);
    }


    public void onContextMenuClosed(@NonNull Menu menu) {

    }


    public Dialog onCreateDialog(int id) {
        return null;
    }

    public Dialog onCreateDialog(int id, Bundle args) {
        return null;
    }


    public void onPrepareDialog(int id, Dialog dialog) {
    }


    public void onPrepareDialog(int id, Dialog dialog, Bundle args) {
    }


    public boolean onSearchRequested(@Nullable SearchEvent searchEvent) {
        return false;
    }


    public boolean onSearchRequested() {
        return getActivity().onSearchRequested();
    }


    public void startSearch(@Nullable String initialQuery, boolean selectInitialQuery, @Nullable Bundle appSearchData, boolean globalSearch) {
    }


    public void triggerSearch(String query, @Nullable Bundle appSearchData) {
    }


    public void takeKeyEvents(boolean get) {

    }

    public void setTheme(int resid) {

    }


    public void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
    }


    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
    }


    public boolean shouldShowRequestPermissionRationale(@NonNull String permission) {
        return false;
    }


    public void startActivityForResult(Intent intent, int requestCode) {
        getActivity().startActivityForResult(intent, requestCode);
    }


    public void startActivityForResult(Intent intent, int requestCode, @Nullable Bundle options) {
    }


    public boolean isActivityTransitionRunning() {
        return false;
    }


    public void startIntentSenderForResult(IntentSender intent, int requestCode, @Nullable Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags) throws IntentSender.SendIntentException {
    }


    public void startIntentSenderForResult(IntentSender intent, int requestCode, @Nullable Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, Bundle options) throws IntentSender.SendIntentException {
    }


    public void startActivity(Intent intent) {
        getActivity().startActivity(intent);
    }


    public void startActivity(Intent intent, @Nullable Bundle options) {
    }


    public void startActivities(Intent[] intents) {
        getActivity().startActivities(intents);
    }


    public void startActivities(Intent[] intents, @Nullable Bundle options) {
    }


    public void startIntentSender(IntentSender intent, @Nullable Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags) throws IntentSender.SendIntentException {
    }


    public void startIntentSender(IntentSender intent, @Nullable Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, Bundle options) throws IntentSender.SendIntentException {
    }


    public void startActivityFromChild(@NonNull Activity child, Intent intent, int requestCode) {
    }


    public void startActivityFromChild(@NonNull Activity child, Intent intent, int requestCode, @Nullable Bundle options) {
    }


    public void startActivityFromFragment(@NonNull Fragment fragment, Intent intent, int requestCode) {
    }


    public void startActivityFromFragment(@NonNull Fragment fragment, Intent intent, int requestCode, @Nullable Bundle options) {
    }


    public void startIntentSenderFromChild(Activity child, IntentSender intent, int requestCode, Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags) throws IntentSender.SendIntentException {
    }


    public void startIntentSenderFromChild(Activity child, IntentSender intent, int requestCode, Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, @Nullable Bundle options) throws IntentSender.SendIntentException {
    }


    public void overridePendingTransition(int enterAnim, int exitAnim) {
    }

    public Uri getReferrer() {
        return null;
    }


    public Uri onProvideReferrer() {
        return null;
    }

    public void setVisible(boolean visible) {

    }


    public void recreate() {

    }


    public void finish() {
        getActivity().finish();
    }


    public void finishAffinity() {
    }


    public void finishFromChild(Activity child) {

    }


    public void finishAfterTransition() {
    }


    public void finishActivity(int requestCode) {
    }


    public void finishActivityFromChild(@NonNull Activity child, int requestCode) {
    }


    public void finishAndRemoveTask() {
    }


    public void onActivityResult(int requestCode, int resultCode, Intent data) {
    }


    public void onActivityReenter(int resultCode, Intent data) {
    }


    public void setRequestedOrientation(int requestedOrientation) {
    }


    public void setTitle(CharSequence title) {
    }


    public void setTitle(int titleId) {
    }


    public void setTitleColor(int textColor) {

    }


    public void onTitleChanged(CharSequence title, int color) {
    }


    public void onChildTitleChanged(Activity childActivity, CharSequence title) {
    }


    public void setTaskDescription(ActivityManager.TaskDescription taskDescription) {
    }

    public void dump(@NonNull String prefix, @Nullable FileDescriptor fd, @NonNull PrintWriter writer, @Nullable String[] args) {
    }


    public void onVisibleBehindCanceled() {

    }


    public void onEnterAnimationComplete() {

    }


    public void setImmersive(boolean i) {
    }


    public void setVrModeEnabled(boolean enabled, @NonNull ComponentName requestedComponent) throws PackageManager.NameNotFoundException {
    }


    public void onActionModeStarted(ActionMode mode) {
    }


    public void onActionModeFinished(ActionMode mode) {
    }


    public void setEnterSharedElementCallback(SharedElementCallback callback) {

    }


    public void setExitSharedElementCallback(SharedElementCallback callback) {
    }


    public void postponeEnterTransition() {
    }


    public void startPostponedEnterTransition() {

    }


    public DragAndDropPermissions requestDragAndDropPermissions(DragEvent event) {
        return null;
    }


    public void startLockTask() {

    }


    public void stopLockTask() {

    }


    public void showLockTaskEscapeMessage() {
    }


    public void setShowWhenLocked(boolean showWhenLocked) {
    }


    public void setInheritShowWhenLocked(boolean inheritShowWhenLocked) {
    }


    public void setTurnScreenOn(boolean turnScreenOn) {
    }

    @Override
    public AndroidInstance use(Object mp, Object... p) {
        return null;
    }


}
